<!DOCTYPE html>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
	<jsp:include page="/common/commonCss.jsp"/>
	<jsp:include page="/common/commonJs.jsp"/>
<script language="javascript">
$(document).ready(function() {
	//设定腕带颜色
	var wristColorId="${wristColorId}";
	var bgColor="";
	switch(wristColorId){
	case "1":
		bgColor="#FF0000";
	  	break;
	case "2":
		bgColor="#FFA500";
	  	break;
	case "3":
		bgColor="#FFFF00";
	  	break;
	case "4":
		bgColor="#7FFF00";
	  	break;
	case "5":
		bgColor="#0000FF";
	  	break;
	case "6":
		bgColor="#00FFFF";
	  	break;
	case "7":
		bgColor="#800080";
	  	break;
	case "8":
		bgColor="#000000";
	  	break;
 	}
	$("#wristColor").css("background-color",bgColor);
	
	initTab("addform", "addTable", "addfoot1", addCodeTr);
});

function initTab(formId, tableId, footId, initTr) {
	var form = $("#" + formId);
	var pagebean = new PageBean(form);
	pagebean.setCallback(initTr);
	pagebean.setFootId(footId);
	pagebean.setTableId(tableId);
	setPagebeanObj(pagebean);
	pagebean.doPage();
}


function addCodeTr(data) { //初始化扫描的条形码 列表
	if(data!=null){
		$.each(data,function(ind,obj){
			var bgColor="";
			var status=obj.status;
			if(status==1){
				//蓝色选中
				bgColor="#5eaee0";
			}else if(status==0){
				//绿色选中
				bgColor="#5fab3c";
			}
			var htm="<tr>";
			htm+='<td style="background:'+bgColor+';" name="'+bgColor+'">'+((obj.ordIndex=="1")?"主人":obj.ordIndex)+'</td>';
			htm+='<td>'+obj.barCode+'<input type="hidden" name="barCodes" value="'+obj.barCode+'" /></td>';
			htm+='<td>'+((obj.guaCount==null)?"0":obj.guaCount)+'<input type="hidden" name="guaCount" value="'+obj.guaCount+'" /></td>';
            htm+='<td>'+obj.inTimeS+'<input type="hidden" name="inTimes" value="'+obj.inTimeS+'" /></td>';
			htm+="</tr>";
			 $("#addTable").find("tr:eq("+ind+")").after(htm);
		});
	}
}
	function yazhengNum(o){
		
		if(!isNaN(o.value)){
			}else{
				$.messager.alert('提示','请输入数字！','warning');
				o.value='';
			}
		 
	}
	
    function qtyUpdate(kind){
    	var inputId ;
        var f = document.getElementById("guaCount");
        var c = f.value;
        if(kind == 1){
            c++;
        }else if(kind == 2){
            if(c >= 1) c--;
        }
        f.value = c;
    }
    
    var wileIn=0;
    function savepartyCode(){
    	var isValid="${isValid}";
    	var overValid="${overValid}";
    	if(isValid=="yes"){
    		alertWarning("只可提前30分钟进场!");
    		return;
    	}else if(overValid=="yes"){
    		alertWarning("派对已超时!");
    		return;
    	}
    	
    	var saoBcodeId =$("#saoBcodeId").val();
    	var guaCount =$("#guaCount").val();
    	
    	if(guaCount>4){
    		alertWarning("一名儿童最多可带4名监护人进场！");
    		return;
    	}
    	
    	if(saoBcodeId==""){
    		alertWarning("请先扫描条或输入条码");
    		return;
    	}else{
    		 var url ='${basePath }parreserve/updatelocalPartyCodeInOutTime.shtml';
 			$.ajax({
 				   url: url,
 				   type: 'POST',
 				   data: 'pkBcodeId='+saoBcodeId+'&guaCount='+guaCount+'&pkParresId=${parreserveOld.pkParresId}&type=${type}',
 				      async:false, 
 				   success:function(msg){
 					    $("#saoBcodeId").val("");//清空条码
						$("#guaCount").val("0");//监护人清0
 						if (msg == "2") {
 								msg="扫描或输入的 条码 有误，与系统条码 不匹配。";
 								alertError(msg);	 
 						}else if (msg == "3") {
 								msg="该成员已进场。";
 								alertError(msg);	 
 						}else{
 							wileIn++;
 							initTab("addform", "addTable", "addfoot1", addCodeTr);
 						}
 				   }
 				  }); 
    	}
    }
    
    
    function partyGoIn(){
    	if(wileIn<=0){
    		var tdNames=document.getElementsByName("#5eaee0");
    		if(tdNames.length==null || tdNames.length=="" || tdNames.length<=0){
    			alertError("请安排需要进场的成员!");
        		return;
    		}
    	}
    	
    	//进场操作
    	$.messager.confirm('提示','是否确定要进场？',function(r) {
    		if (r) {
    			$.ajax({
    				   cache : false,
    				   type: 'POST',
    				   url : "locPartyGoIn.shtml",
    				   data :$("#inForm").serialize(),
    				   success:function(batPath){
    					 	//入场
   							var wsh=null;
     						try {
   	  							wsh = new ActiveXObject("WScript.Shell"); //允许bat文件  
   							} catch (e) {
   								alert(e.message);
   							}
   							try {
   								wsh.run(batPath);
   							} catch (e) {
   								//alert(e.message);
   							}
    					   window.location.href="${basePath}management/site/locPerManager.shtml?type=1";//跳转入场客人选择
    				   }
    			});
    		}
    	});
    }
</script>

<title>首页</title>
</head>
<body class="bg">

<div class="content m_auto">
	<div class="content_l mt10">
    	<ul>
        	<shiro:hasPermission name="management/site/locPerManager.shtml?type=1">
				<li <c:if test="${type==1 }">class="content_hover"</c:if>><a href="${basePath}management/site/locPerManager.shtml?type=1"><i class="nav_icon_c"></i><br>入场管理</a></li>
			</shiro:hasPermission>
        	<shiro:hasPermission name="management/site/locPerManager.shtml?type=2">
            	<li <c:if test="${type==2 }">class="content_hover"</c:if>><a href="${basePath}management/site/locPerManager.shtml?type=2"><i class="nav_icon_i"></i><br>出场管理</a></li>
            </shiro:hasPermission>
            <shiro:hasPermission name="management/site/locPerMemer.shtml">
            	<li><a href="${basePath}management/site/locPerMemer.shtml"><i class="nav_icon_j"></i><br>场内人员</a></li>
            </shiro:hasPermission>
        </ul>
    </div>
    <div class="content_r mt10">
    	<div class="collection_img m30 fl">
            <span class="collection_span">
            		<c:if test="${zhuanyuanUser.imagePath!=null && zhuanyuanUser.imagePath!='' }">
                   		<img class="colle_img" src="${basePath}common/showImage.shtml?imagePath=${zhuanyuanUser.imagePath}" width="150" height="198">
                    </c:if>
                    <c:if test="${zhuanyuanUser.imagePath==null || zhuanyuanUser.imagePath=='' }">
                   		<img src="${basePath }commonCss/images/index_02.png" class="colle_img" width="150" height="198">
                    </c:if>
            </span>
            <p class="p10 fixed" title="${zhuanyuanUser.usrName }">
            	<i class="fl">
            		<c:choose> 
						<c:when test="${fn:length(zhuanyuanUser.usrName) > 5}">${fn:substring(zhuanyuanUser.usrName, 0, 5)}...</c:when> 
						<c:otherwise>${zhuanyuanUser.usrName}</c:otherwise>
					</c:choose>
            	</i>
            	<i class="fr" style="color:#F00">专员</i>
            </p>
        </div>
        <div class="mana_reg_dl fl">
        	<dl class="mt30 f14">
            	<dt><label>主题：</label><input name="subject" value="${parreserveOld.subject}" type="text" class="iput_t w200"   disabled></dt>
                <c:choose>
	                 <c:when test="${parreserveOld.grpFlag=='1'}">
	                 </c:when>
	                 <c:otherwise>
	                   <dt><label>儿童姓名：</label><input id="chdName" value="${parreserveOld.chdName}" name="chdName" type="text" class="iput_t w200"   disabled></dt>
	                 </c:otherwise>
                </c:choose>
                <dt><label>联系人：</label><input name="conName" id="conName"  type="text" class="iput_t w200" value="${parreserveOld.conName}" disabled></dt>
                <dt><label>固话：</label><input type="text" name="conTel" id="conTel" class="iput_t w200" value="${parreserveOld.conTel}" disabled></dt>
                <dt><label>手机：</label><input type="text" class="iput_t w200" value="${parreserveOld.conMobile}" disabled></dt>
                <dt><label>Email：</label><input type="text" class="iput_t w200" value="${parreserveOld.conEmail}" disabled></dt>
                <dt><label>房间：</label><input type="text" class="iput_t w200" value="${parreserveOld.roomIds}" disabled></dt>
                <dt><label>预约日期：</label><input type="text" class="iput_t w200" value="${parreserveOld.presDay}" disabled ></dt>
                <dt><label>预约时间：</label><input type="text" class="iput_t w200" value="${parreserveOld.resTimeS}" disabled></dt>
                <dt><label>加时：</label>
                <c:choose>
	                 <c:when test="${parreserveOld.overTime==1}">
	                  <input type="text" class="iput_t w200" value="1小时" disabled >
	                 </c:when>
	                 <c:when test="${parreserveOld.overTime==2}">
	                  <input type="text" class="iput_t w200" value="2小时" disabled >
	                 </c:when>
	                 <c:otherwise>
	                   <input type="text" class="iput_t w200" value="" disabled >
	                 </c:otherwise>
	            </c:choose>
                </dt>
                <dt><label>加时房间类型：</label>
                <c:choose>
	                 <c:when test="${parreserveOld.fkOtprdId=='ZBSP141126001'}">
	                  <input type="text" class="iput_t w200" value="小房间" disabled >
	                 </c:when>
	                 <c:when test="${parreserveOld.fkOtprdId=='ZBSP141126002'}">
	                  <input type="text" class="iput_t w200" value="大房间" disabled >
	                 </c:when>
	                 <c:otherwise>
	                   <input type="text" class="iput_t w200" value="" disabled >
	                 </c:otherwise>
	            </c:choose>
                </dt>
                <dt><label>人数：</label><input type="text" class="iput_t w200" value="${parreserveOld.resMemCnt}" disabled></dt>
                <dt><label>状态：</label>进行中</dt>
                <dt><label class="vt">备注：</label><textarea class="textare w200" disabled>${parreserveOld.comments}</textarea></dt>
            </dl>
        </div>
        <div class="fl mt30 ml50 w540">
        	<h2>腕带颜色：<input id="wristColor" type="text" class="iput_t w50" value="${wristColor}" disabled>
        	<span class="ml20">条码：<input type="text" id="saoBcodeId" class="iput_t w100" onkeyup="yazhengNum(this)"></span>
        	<span class="ml20">监护人：
                    <a class="jia_icon" href="javascript:qtyUpdate(2)"></a>
                    <input class="iput_t w50" name="guaCount" id="guaCount" onkeyup="yazhengNum(this)" type="text" style="text-align: center;" value="0">
                    <a class="jian_icon" href="javascript:qtyUpdate(1)"></a>  
                    <input type="button" value="确定" onclick="savepartyCode()" class="btn_l">
                </span></h2>
        <form id="inForm" action="locPartyGoIn.shtml" method="post">
       		<input type="hidden" name="type" value="${type }">
       		<input type="hidden" name="pkParresId" value="${parreserveOld.pkParresId }">
       		<div class="mt10" style="height: 408px; overflow-y: auto;">
            <table class="table" id="addTable">
            	<tr>
                	<th width="90">编号</th>
                    <th>条形码</th>
                    <th>监护人</th>
                    <th>入场时间</th>
                </tr>
            </table>
            </div>
        </form>
            <!-- <div class="page fr m10" id="addfoot1"></div> -->
    </div>
    <div class="clear"></div>
        <div class="btm_btn mt30">
        	<dl>
            	 <dd><a href="${basePath}management/site/locPerManager.shtml?type=1"><input type="button" class="btn" value="取&nbsp;&nbsp;消"></a></dd>
                <dd><a href="javascript:partyGoIn();"><input type="button" class="btn" value="进&nbsp;&nbsp;场"></a></dd>
            </dl>
        </div>
</div>
 <form action="${basePath }parreserve/localPartyInCodeList.shtml" method="post" id="addform">
							<input type="hidden" name="pageSize" value="12">
							<input type="hidden" name="fkParresId" value="${parreserveOld.pkParresId}">
							  <input type="hidden" name="pageNo" value="1">  
		</form>
</body>
</html>
















